package times

import "time"

//每天整时执行
//@h,小时,小于24
func BlockDay(h ...int) {
	m := make(map[int64]int, 10)
	if len(h) == 0 {
		m[0] = 0
	}
	for _, v := range h {
		t := int64(v * 60 * 60)
		if t >= 24*60*60 {
			t = 24*60*60 - 1
		}
		m[t] = v
	}
	for {
		time.Sleep(time.Second * 1)
		t2 := time.Now().Unix() - Now().IntegerDay().Unix()
		if _, ok := m[t2]; ok {
			return
		}
	}
}
